home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
comm
/
net
/
dnet2_10_13.lha
/
DNet
/
Amiga
/
Sourcen.lha
/
lib
/
makechannel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-14
|
994b
|
49 lines
/*
* MakeChannel.C
*
* (internal routine)
*/
#include "lib.h"
short DUseSignal = -1;
void *
MakeChannel(ior, host)
IOSTD *ior;
char *host;
{
CHANN *chan = AllocMem(sizeof(CHANN), MEMF_PUBLIC|MEMF_CLEAR);
/* Name, Pri */
chan->port.mp_Node.ln_Type = NT_MSGPORT;
if (DUseSignal >= 0)
chan->port.mp_SigBit = DUseSignal;
else
chan->port.mp_SigBit = AllocSignal(-1);
chan->port.mp_SigTask = FindTask(NULL);
NewList(&chan->port.mp_MsgList);
NewList(&chan->rdylist);
chan->chan = (long)ior->io_Unit;
ior->io_Offset = (long)chan;
if (host) {
char buf[sizeof(DNETPORTNAME)+32];
sprintf(buf, "%s%s", DNETPORTNAME, host);
ior->io_Message.mn_ReplyPort = FindPort(buf);
}
chan->dnetport = ior->io_Message.mn_ReplyPort;
return((void *)chan);
}
void
DeleteChannel(_chan)
void *_chan;
{
CHANN *chan = (CHANN *)_chan;
if (chan->port.mp_SigBit != DUseSignal)
FreeSignal(chan->port.mp_SigBit);
FreeMem(chan, sizeof(CHANN));
}